<%@ page language="java" contentType="text/html; charset=utf-8"
    pageEncoding="utf-8"%>
<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<link href="<c:url value='/insdep/reset.min.css' />" rel="stylesheet" type="text/css">
	<link href="<c:url value='/insdep/easyui_full.css'/>" rel="stylesheet" type="text/css">
	<link href="<c:url value='/insdep/icon.css'/>" rel="stylesheet" type="text/css">
	<script type="text/javascript" src="<c:url value='/insdep/jquery-1.11.3.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/insdep/jquery.easyui-1.5.2.min.js'/>"></script>
	<script type="text/javascript" src="<c:url value='/insdep/insdep-extend.min.js'/>"></script>
	
<title>创建新部门</title>
</head>
<body>
	<script type="text/javascript">
	function state(val) {
		return {0:false, 1:true}[val];
	}
	</script>
	<script type="text/javascript">
		$(function(){
			/**
			 *关闭编辑窗口
			 */
			$("#close").linkbutton({
				onClick:function(){
					$("#create_and_edit_deptinfo_win").window('close');
				}
			});
			/**
			 *提交表单并保存信息
			 */
			 $("#save").linkbutton({
				 onClick:function(){
					 $('#create_dept').form({    
						    url:'edit_adds_Dept',    
						    onSubmit: function(param){    
						    	
						    	return $(this).form("validate");//验证
						    },    
						    success:function(data){ 
						    	/**
						    	 *操作结果
						    	 */
						        if(data) {
									$("#create_and_edit_deptinfo_win").window('close');
									$('#dept_info_dg').datagrid('reload');
									//提示信息
									$.messager.show({
										title:'提示',msg:'保存信息成功！',timeout:1000,showType:'show',
										style:{
								            right:'', bottom:'' 
										}
									});
						        } else{
						        	//提示信息
						        	$.messager.show({
										title:'提示',msg:'保存信息失败', timeout:1000,showType:'show',
										style:{
								            right:'', bottom:'' 
										}
									});
						        }   
						    }    
						});    
						   
						$('#create_dept').submit();  
				 }
			 });
			
		});
	</script>
	<form id="create_dept" >
		<div style="margin: 20px;">
			<input name="deptId" class="easyui-textbox" type="hidden"  > 
		</div>
		<div style="margin: 20px;">
			<input name="deptName" class="easyui-textbox" data-options="required:true" label="部门名称：" style="width:300px"> 
		</div>
		<div style="margin: 20px;">
			<input id="superDept" name="superDept" class="easyui-combobox" name="dept" label="上级部门：" data-options="valueField:'id',width:200, textField:'text',editable:false,panelHeight:'auto'"/>  
		</div>
		<div style="margin: 20px 105px;position: relative;top:150px;">
			<a id="save" class="easyui-linkbutton" data-options="iconCls:'icon-save'" >保存</a>
			<a id="close" class="easyui-linkbutton" data-options="iconCls:'icon-no'" style="margin-left:30px;">取消</a>
		</div>
	</form>	
</body>
</html>